home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD ROM Paradise Collection 4
/
CD ROM Paradise Collection 4 1995 Nov.iso
/
science
/
sm32a.zip
/
SYMBMATH.H17
< prev
next >
Wrap
Text File
|
1994-03-29
|
3KB
|
67 lines
3.3.7 Read and Write Statements
The format of the readfile statement is
readfile("filename")
The filename is any MS-DOS file name. If the file is not in the current
directory, the filename should include the directory. e.g.
readfile("directory\filename")
e.g. read a file named "inte.sm":
readfile("inte.sm")
It seems to copy the file into the user program.
After a file is read, you can call any part of this package from
a second package, as it seems the part of the first program has already
been in the second program. you can read many files into the SymbMath
program at a time. However, all names of the variables are public and
name conflicts must be avoided.
Write a file to disk by
openfile("file")
...
closefile("file")
Table 3.3.7. Reading and Writing Statements
---------------------------------------------------------------------
readchar read a charactor from keyboard.
readline read a line of strings from keyboard.
readfile("file") read (run or include) the file named "file".
......................................................................
openfile("file") open the disk file "file" for writing.
closedfile("file") closed the file "file".
writes(s) write s on screen, only on graphics mode.
newline write next text on a new line.
null not write.
block(a,b) write the value of the last arguement, b.
---------------------------------------------------------------------
where the filename is any MS-DOS filename.
Note that the file must be closed by the closefile() command when
writing a file with the openfile() command, but the file is automatically
closed after reading the file. There must be the end statement at the end
of file for reading.
SymbMath can read expressions from a disk file, then manipulate
the expression, and finally write the result into another disk file.
Example: an expression y:=x^6 is already in the file "y.in",
The contents of the file "y.in":
---------------------------------------------------------------------
y:=x^6
-----------------------------------------------------------------------
run this SymbMath program
----------------------------------------------------------------------------
readfile("y.in") # read the expression y:=x^6 from the file "y.in"
openfile("y.out") # open a disk file "y.out" for writing
d(y,x) # differentiate y and write the result to the file
closefile("y.out") # close the file and return output to SymbMath
----------------------------------------------------------------------------
The contents of the file "y.out":
---------------------------------------------------------------------
6*x^5
---------------------------------------------------------------------
In this way you can interface to other software (see 3.7. Interface with
Other Software).
These outputs in the disk file can be edited in the Edit window
or the Aux Edit window.
It is recommended to use the BASIC output format by setting
the switch output:=basic when you write the output into the disk file.
The default switch is output:=math.